package com.example.springcloud.service;

import java.util.List;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.example.springcloud.entity.Dept;

/**
 * Feign接口需要使用@FeignClient注解指定提供了哪一个 服务提供者 所提供的服务（使用服务名指定）
 * @author JZH
 *
 * @FeignClient：启用面向接口的服务调用，fallbackFactory属性指定熔断器，当服务不可用的时候调用熔断器
 */
@FeignClient(value="microservicecloud-dept",fallbackFactory=DeptClientServiceFallbackFactory.class)
public interface DeptClientService {

	@RequestMapping(value="dept/get/{deptno}", method=RequestMethod.GET)
	Dept get(@PathVariable("deptno") Long deptno);
	
	@RequestMapping(value="dept/list", method=RequestMethod.GET)
	public List<Dept> list();
	
	@RequestMapping(value="dept/add", method=RequestMethod.POST)
	public boolean add(Dept dept);

	
}
